home *** CD-ROM | disk | FTP | other *** search
/ F1 Licenseware / F1 Licenseware - Volume 1.iso / disks / 050a.dms / 050a.adf / TEXTS / chapter08.txt < prev    next >
Text File  |  1992-02-26  |  5KB  |  232 lines

  1.                      The Absolute Beginners Guide To Amos
  2.                     -------------------------------------
  3.                                 Chapter eight
  4.                                 -------------
  5. In this chapter we are going to cover three fairly easy commands and have
  6. the second of our self testing quizzes, so take it easy, relax, learn and
  7. enjoy yourself.
  8.  
  9.  
  10. REM A small program to demonstrate the CHANGE MOUSE command
  11.  
  12. CURS OFF: PAPER 8: PEN 0: CLS 8
  13.  
  14. CENTRE "A DEMO OF CHANGE MOUSE"
  15.  
  16. PEN 3
  17.  
  18. LOCATE 0,10: CENTRE "NORMAL MOUSE POINTER"
  19.  
  20. WAIT 200
  21.  
  22. LOCATE 0,10: CENTRE "THE CROSS HAIR POINTER"
  23.  
  24. CHANGE MOUSE 2
  25.  
  26. WAIT 200
  27.  
  28. LOCATE 0,10: CENTRE "CLOCK MOUSE POINTER YUK!"
  29.  
  30. WAIT 200
  31.  
  32. EDIT
  33.  
  34.  
  35.  
  36. The breakdown:
  37.  
  38. The first line should be familiar to you except for one command.
  39.  
  40. PEN 0
  41. -----
  42. PEN N, sets the colour of the text you want to print to the screen, do not
  43. confuse with PAPER N which controls the background colour of the text.
  44. The N can be any colour 0-15 the same as PAPER, the numbers 0-15 are the
  45. colour indexes and as we are using the Amos default screen which contains
  46. 16 colours, 0-15 inclusive, we are OK. I will show you later how to create
  47. your own custom screens of different sizes and colours, but don`t think 
  48. about that for now.
  49.  
  50.  
  51. CENTRE "A DEMO OF CHANGE MOUSE"
  52. -------------------------------
  53. I like the CENTRE command it does a lot of work for one simple command. 
  54. As you have probably guessed it CENTREs a string of text on the screen.
  55. It always uses the current cursor position so if we had a program that did
  56. the following, what do you think would happen?
  57.  
  58. CENTRE "WIBBLE"
  59. CENTRE "MORE TEXT"
  60.  
  61. What would happen is all that would appear on screen is MORE TEXT because
  62. it would overwrite WIBBLE as the cursor position is unmoved. If we did this:
  63.  
  64. CENTRE "WIBBLE"
  65. PRINT
  66. CENTRE "MORE TEXT"
  67.  
  68. We would see this on screen,
  69.  
  70. WIBBLE
  71. MORE TEXT
  72.  
  73. Because the PRINT statement moved the cursor down a line.
  74.  
  75. You can also CENTRE a string variable using CENTRE if you want like this:
  76.  
  77. A$="WIBBLE BOTTOM"
  78. CENTRE A$
  79.  
  80. Right that`s enough about CENTRE there is more info on this in EXAMPLE8.Amos
  81.  
  82.  
  83. PEN 3
  84. -----
  85. Yes, this is interesting. We have just covered PEN N, but I left out the 
  86. juicy bit until we got to the actual line.  The PEN 3 command sets the
  87. text colour to 3, fair enough, but colour 3 is set by default to flash!
  88. This is useful for drawing attention to text as you will see in EXAMPLE8.Amos
  89. We can stop colour 3 from flashing by using the FLASH OFF command.
  90.  
  91.  
  92. CHANGE MOUSE 2
  93. --------------
  94. This command, as if you didn`t know, CHANGEs the MOUSE pointer as follows:
  95.  
  96. CHANGE MOUSE 1  REM The default (horrid) orange pointer
  97.  
  98. CHANGE MOUSE 2  REM The cross hair pointer
  99.  
  100. CHANGE MOUSE 3  REM The Clock pointer
  101.  
  102. There are other ways to change the mouse pointer, which I may cover later 
  103. but this is the easiest way for now.
  104.  
  105.  
  106. Everything else in the program should by now be self explanatory.
  107.  
  108.  
  109. What you should understand since the last Notes list.
  110. -----------------------------------------------------------------
  111.  
  112. *Please note the following is not a program.
  113.  
  114.  
  115. ANY:       : A label, a marker to tell GOTO amongst others, where to jump to
  116.  
  117. BELL       : Make a bell type sound
  118.  
  119. BOOM       : Make an explosion type sound
  120.  
  121. CENTRE $   : CENTRE a string of text on current line
  122.  
  123. CHANGE MOUSE N : CHANGE the mouse pointer 1,2 or 3. 1 is default
  124.  
  125. FLASH OFF  : Unset colour 3 so it does not FLASH 
  126.  
  127. GOTO       : GOTO a previously defined Label
  128.  
  129. LOCATE N,N : Set text cursor to position N across and N down
  130.  
  131. PEN N      : Set the color of any text, PEN 3 FLASHes by default
  132.  
  133. RND (N)    : Generate a RaNDom number between 0 and N-1
  134.  
  135. SHOOT      : Make a gun fire type sound
  136.  
  137. WAIT N     : Halt program for N*50ths of a second
  138.   
  139.       ------------------------------------------------------------------
  140.  
  141.                            SELF TESTING QUIZ Part 2
  142.                           ==========================
  143.                 You can refer to your notes if you need them.
  144.           Make a note of each answer a, b or c. Answers next chapter.
  145.  
  146.  
  147. Q 1. What is wrong with the following piece of code?
  148.      
  149.      LABEL
  150.      WAIT 1000
  151.      GOTO LABEL
  152.  
  153.   a) The : is missing from LABEL
  154.   b) The 1000 in WAIT is too long
  155.   c) GOTO is spelt wrong
  156.  
  157.  
  158. Q 2. Name the three built in sound effects
  159.  
  160.   a) BULL, BLOOM, SHUT
  161.   b) BELL, BOOM, SHOOT
  162.   c) BELL, BUM, SHOT
  163.  
  164.  
  165. Q 3. How would you CENTRE the following text on the screen?
  166.  
  167.      "MORE TEXT"
  168.     
  169.   a) CENTRE MORE TEXT
  170.   b) "MORE TEXT"; CENTRE
  171.   c) CENTRE "MORE TEXT"
  172.  
  173.  
  174. Q 4. How many CHANGE MOUSE options are there (that we have covered so far)?  
  175.  
  176.   a) 1
  177.   b) 2
  178.   c) 3
  179.  
  180.  
  181. Q 5. What colour is set to FLASH as default?
  182.  
  183.   a) 2
  184.   b) 3
  185.   c) 4
  186.  
  187.  
  188. Q 6. What is the correct code to set the text cursor to 5 across 3 down?
  189.  
  190.   a) LOCATE 5,5
  191.   b) PEN    5,3   
  192.   c) LOCATE 5,3
  193.  
  194.  
  195. Q 7. What range of random numbers would this produce?
  196.  
  197.      RND (9)
  198.  
  199.   a) 0 to 8
  200.   b) 0 to 9
  201.   c) 1 to 9
  202.  
  203.  
  204. Q 8. How long would this halt the program for?
  205.  
  206.      WAIT 50
  207.  
  208.   a) 1 minute
  209.   b) 1/50th of a second
  210.   c) 1 second
  211.  
  212.  
  213. Q 9. How would you stop colour 3 from FLASHing?
  214.  
  215.   a) STOP FLASH
  216.   b) FLASH OFF
  217.   c) NO FLASH
  218.  
  219.  
  220. Q10. What would appear on the screen when you run this program?
  221.  
  222.      CENTRE "SOME TEXT"
  223.      CENTRE "EVEN MORE"
  224.  
  225.   a) SOME TEXT
  226.   b) EVEN MORE
  227.   c) NOTHING
  228.  
  229.  
  230.                             End of chapter eight
  231.                             ^^^^^^^^^^^^^^^^^^^^
  232.